package com.wgy.day9.Array数组;

/**
 * Created by pc on 2020/11/5 22:30
 * Description: LearningJava
 */
public class Demo02ArrayReturn {
    public static void main(String[] args) {
        int[] result = calculate(10, 20, 30);
        System.out.println(result[0]);
        System.out.println("main方法接收到的返回值数组是");
        System.out.println(result);

    }

    public static int[] calculate(int a, int b, int c) {
        int sum = a + b + c;
        int avg = sum / 3;
        /*int[] array= new int[2];
        array[0]=sum;
        array[1]=avg;*/
        int[] array = {sum, avg};
        System.out.println("calculate方法内部数组是:");
        System.out.println(array);
        return array;
    }
}
